; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=gvn -pass-remarks-analysis=gvn -S < %s | FileCheck %s

define ptr @ReplaceWithTidy(ptr %one, ptr %two, ptr %three) {
; CHECK-LABEL: @ReplaceWithTidy(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load ptr, ptr [[ONE:%.*]], align 8
; CHECK-NEXT:    store ptr [[TMP0]], ptr [[TMP0]], align 8
; CHECK-NEXT:    store ptr null, ptr [[TWO:%.*]], align 8
; CHECK-NEXT:    [[TMP1:%.*]] = load ptr, ptr [[TMP0]], align 8
; CHECK-NEXT:    store ptr [[TMP1]], ptr [[THREE:%.*]], align 8
; CHECK-NEXT:    ret ptr null
;
entry:
  %0 = load ptr, ptr %one, align 8
  store ptr %0, ptr %0, align 8
  store ptr null, ptr %two, align 8
  %1 = load ptr, ptr %0, align 8
  store ptr %1, ptr %three, align 8
  ret ptr null
}
